<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>PHP Adsense Account Library</title>
	<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
	<style media="all" type="text/css">

    </style>
</head>
<body>
	<h1>PHP AdSense Account Library</h1>
	<p><em>Based on <a href="http://www.webtoolkit.info/php-adsense-account-monitor.html">PHP AdSense account monitor class</a></em></p>
	<p>PHP AdSense Account Library is a class that can retrieve various data
	from an AdSense account.</p>

	<h2>Examples</h2>

  <pre>require_once('adsense.php');

$username = 'your_email@gmail.com';
$password = '*******';

$adsense = new AdSense();
if ($adsense->connect($username, $password)) {
    var_dump($adsense->today());
} else {
    die('Could not login to AdSense account.');
};
  </pre>

	<h2>API</h2>
	<h3>connect($username, $password)</h3>
	<p>Connects to AdSense account using supplied credentials.
    Returns true on unsuccessful connection, false otherwise.</p>

	<h3>log_out()</h3>
	<p>Log out from adsense. Useful when getting data from two or more
	accounts.</p>

	<h3>today()</h3>
	<p>Gets AdSense data for the period: today. Returns associative array with
	collected data</p>

	<h3>yesterday()</h3>
	<p>Gets AdSense data for the period: yesterday. Returns associative array
	with collected data</p>

	<h3>last7days()</h3>
	<p>Gets AdSense data for the period: last7days. Returns associative array with
	collected data</p>

	<h3>lastmonth()</h3>
	<p>Gets AdSense data for the period: lastmonth. Returns associative array
	with collected data</p>

	<h3>thismonth()</h3>
	<p>Gets AdSense data for the period: thismonth. Returns associative array
	with collected data</p>

	<h3>sincelastpayment()</h3>
	<p>Gets AdSense data for the period: sincelastpayment. Returns associative
	array with collected data</p>

	<h3>get_report_id_from_name($name)</h3>
	<p>Get current report id by report name. Helps to avoid problems with
	report editing and ids.</p>

	<h3>get_report_as_csv($report_id, $encoding = 'UTF-8')</h3>
	<p>Get csv data from custom report.</p>
	<p class="warning">Warning: if you will edit report at Google Adsense page, its id will change!</p>

	<h3>report($report_id)</h3>
	<p>Get report data as array. Uses html parser. A bit slower than get_report_as_csv().</p>
	<p class="warning">Warning: if you will edit report at Google Adsense page, its id will change!</p>

	<h3>quick_report($url)</h3>
	<p>&copy; 2009, <a href="http://alexpolski.com/">Alex Polski</a>, <a href="http://rmcreative.ru/">Alexander Makarov</a></p>
</body>
